<div class="page-search-bar">
	<div class="widget-header">
		<div class="align-left">
			<%= simple_form_for(purchase_orders_path, :method => 'get') do |f| %>
			<input type="text" name="purchase_order[po_number]" class="input-xs" placeholder="采购合同号">									
			<div class="widget-buttons buttons-bordered">
				<input class="btn btn-blue btn-xs" name="commit" type="submit" value="搜索">
			</div>
			<% end %>
		</div>
	</div>
</div>

<div class="row">
	<div class="col-xs-12 col-md-12">

		<div class="widget">

			<div class="widget-header bordered-bottom bordered-themeprimary">
				<i class="widget-icon fa fa-tasks themeprimary"></i>
				<span class="widget-caption themeprimary">采购订单列表</span>
				<div class="widget-buttons buttons-bordered">
					<%= button_to '新建采购订单', new_purchase_order_path, method: :get, :class => "btn btn-blue btn-xs" %>
				</div>

			</div><!--Widget Header-->
			<div class="widget-body">
				<div class="widget-main no-padding">

					<div class="flip-scroll">
						<div class="dataTables_wrapper form-inline no-footer">
							<table class="table table-bordered table-striped table-condensed flip-content">
								<thead class="flip-content bordered-palegreen">
									<tr>
										<th>合同日期</th>
										<th>合同号</th>
										<th>供应商</th>										
										<th>合同金额</th>
										<th>结算方式</th>
										<th>应付款日期</th>
										<th>发票状态</th>
										<th>发票号</th>
										<th>发票金额</th>
										<th>到票日期</th>
										<th>已付金额</th>
										<th>余额</th>
										<th colspan="3"></th>
									</tr>
								</thead>

								<tbody>
									<% @purchase_orders.each do |purchase_order| %>
									<tr>
										<td><%= purchase_order.date %></td>
										<td><%= purchase_order.po_number %></td>
										<td><%= purchase_order.supplier.name %></td>										
										<td><%= purchase_order.amount %></td>
										<td><%= purchase_order.payment_term %></td>
										<td><%= purchase_order.dueday %></td>
										<td><%= purchase_order.invoice_state %></td>
										<td><%= purchase_order.invoice_no %></td>
										<td><%= purchase_order.invoice_amount %></td>
										<td><%= purchase_order.invoice_received_date %></td>
										<td><%= purchase_order.amount_paid %></td>
										<td><%= purchase_order.balance %></td>
										<td><%= link_to image_tag('show.png'), purchase_order %></td>
										<td><%= link_to image_tag('edit.gif'), edit_purchase_order_path(purchase_order) %></td>
										<td><%= link_to image_tag('trash.gif'), purchase_order, method: :delete, data: { confirm: 'Are you sure?' } %></td>
									</tr>
									<% end %>
								</tbody>

							</table>
							<div class="row DTTTFooter">
								<div class="col-xs-12 col-md-12">
									<div class="dataTables_paginate paging_bootstrap" id="simpledatatable_paginate">
										<%= paginate @purchase_orders, window: 1, outer_window: 1, remote: true %>
									</div>
								</div>
							</div>

						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
